/*
 * Card.cpp
 *
 *  Created on: 07.08.2012
 *      Author: Axel
 */

#include "Card.h"
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;



string Card::getSymbolString()
{
	string s;

	switch(Symbol)
	{
	case HERZ:
		s = "Herz";
		break;

	case KARO:
		s = "Karo";
		break;

	case PIK:
		s = "PIK";
		break;

	case KREUZ:
		s = "KREUZ";
		break;

	default:
		cout << "Symbol: " << Symbol << " existiert nicht" <<endl;
	}

	return s;

}

char Card::getNumberChar()
{
	char num = 0;

	if (Number >= 2 and Number <= 9)
			num = (char)Number + 48;
		else if(Number == 10)
			num = 'T';
		else if(Number == BUBE)
			num = 'J';
		else if(Number == DAME)
			num = 'Q';
		else if(Number == KOENIG)
			num = 'K';
		else if(Number == ASS)
			num = 'A';
		else
			std::cout << "No Card with Number: " << Number << " exists" << endl;

	return num;
}

Card::Card() {
	// TODO Auto-generated constructor stub

}

Card::~Card() {
	// TODO Auto-generated destructor stub
}

Card::Card(int num, int sym)
{
	if(num >= 2 and num <= ASS and sym >= HERZ and sym <= KREUZ)
	{
		Symbol = sym;
		Number = num;
	}
	else
	{
		cout << "Card Constructor - error" << endl;
	}
}


int Card::getSymbol(void)
{
	return Symbol;
}

int Card::getNumber(void)
{
	return Number;
}

bool Card::isHigher(Card card)
{
	return Number > card.getNumber();
}

bool Card::isSameSymbol(Card card)
{
	return (Symbol == card.getSymbol());
}

string Card::toString()
{
	string s = getNumberChar() + string(" ") + getSymbolString();


	return s;
}
